<style>
	.button-table{
		margin-top:10px;
		margin-left:26px;
	}
	.loader{
		position:fixed;
		top:0;
		left:0;
		background:rgba(255,255,255,0.8) url('<?php echo base_url("assets/images/loading.gif");?>') no-repeat 50%;
		height:100%;
		width:100%;
		z-index:900;
		overflow:hidden;
	}
</style>
<link href="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.css" type="text/css" rel="stylesheet" />
<link href="<?php echo $this->config->item('css_path');?>/icons.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->config->item('plugin_path');?>/forms/togglebutton/toggle-buttons.css" type="text/css" rel="stylesheet" />

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default gradient">
			<div class="panel-heading">
				<h4>
					<span>Grid Master Periode</span>
				</h4>
			</div>
			 <div class="panel-body noPad clearfix">
				<table cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table table-bordered" width="100%">
					<thead>
						<tr>
							<th><center>No.</center></th>
							<th>Hapus</th>
							<th>Edit</th>
							<th>Tanggal Awal</th>
							<th>Tanggal Akhir</th>
							<th>Keterangan</th>
							<th>Status</th>
						</tr>
					</thead>
					<tbody>
					<?php
						$no=0;
						foreach($data_periode as $row){
						$no++;
					?>
						<tr class="odd gradeX">
							<td><center><?php echo $no; ?></center></td>
							<td>
								<div class="controls center">
									<a href="javascript:hapus(<?php echo $row["ID_PERIODE"]; ?>)" title="Edit Data" class="tip"><span class="icon14 wpzoom-trashcan"></span></a>
								</div>
							</td>
							<td>
								<div class="controls center">
									<a href="javascript:edit(<?php echo $row["ID_PERIODE"]; ?>)" title="Edit Data" class="tip"><span class="icon14 icomoon-icon-pencil"></span></a>
								</div>
							</td>
							<td><?php echo date('d-m-Y',strtotime($row["TGL_AWAL"]));?></td>
							<td><?php echo date('d-m-Y',strtotime($row["TGL_AKHIR"]));?></td>
							<td><?php echo $row["KETERANGAN"];?></td>
							<td>								
								<?php if($row["STATUS_PERIODE"] == 0){?>
									<div class="normal-toggle-button" onclick="tidak_aktif(<?php echo $row['ID_PERIODE']?>)">
										<input type="checkbox" class="nostyle">
									</div> 
								<?php }elseif($row["STATUS_PERIODE"] == 1){?>
									<div class="normal-toggle-button">
										<input type="checkbox" checked="checked" class="nostyle" disabled="disabled">
									</div> 
								<?php }?>
							</td>
						</tr>
					<?php
					}
					?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>
<!-- Table plugins -->
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/TableTools.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/ZeroClipboard.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/responsive-tables/responsive-tables.js"></script>

<!-- Charts plugins -->
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>charts/sparkline/jquery.sparkline.min.js"></script><!-- Sparkline plugin -->

<!-- Form plugins -->
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/elastic/jquery.elastic.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/inputlimiter/jquery.inputlimiter.1.3.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/maskedinput/jquery.maskedinput-1.3.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/togglebutton/jquery.toggle.buttons.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/uniform/jquery.uniform.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/globalize/globalize.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/color-picker/colorpicker.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/timeentry/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/select/select2.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/dualselect/jquery.dualListBox-1.3.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>forms/tiny_mce/tinymce.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('js_path');?>supr-theme/jquery-ui-sliderAccess.js"></script>
<!-- Init plugins -->
<script type="text/javascript" src="<?php echo $this->config->item('js_path');?>forms.js"></script>
<!-- Table plugins -->
<script type="text/javascript" src="<?php echo $this->config->item('js_path');?>datatable.js"></script>
<!-- Misc plugins -->
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>misc/nicescroll/jquery.nicescroll.min.js"></script>
<script>
function tambah(){
	document.location="<?php echo site_url("master/form_periode")?>";
}
function edit(id){
	document.location="<?php echo site_url("master/form_periode")?>/"+id;
}
function hapus(id){
	var r = confirm("Anda yakin ingin menghapus data ini ?");
	if(r == true){
		document.location="<?php echo site_url("master/delete_periode")?>/"+id;
	}
}
function aktif(){
	alert("Periode Sudah Aktif");
}
function tidak_aktif(id){
	var res	= {
		loader:$('<div />', {class: 'loader'}),
		maincol: $('body')
	}
	res.maincol.append(res.loader);
	document.location = "<?php echo site_url('master/ganti_status')?>/"+id;
}
</script>